<template>
	<view class="container">
		<view class="header">
			<view class="headerBg"></view>
			<view class="panel">
				<view class="panelBg"></view>
				<view class="myCoin">
					<view class="num">
						40500
					</view>
					<view class="text">
						我的金币(个)
					</view>
				</view>
				<view class="toDadyCoin">
					<view class="num">
						2217
					</view>
					<view class="text">
						今日金币(个)
					</view>
				</view>
			</view>
			<view class="panel-btn">
				<view class="extractBtn" @click="handleExtract">
					可提现4.05元
				</view>
				<view class="rechargeBtn" @click="handleRecharge">
					立即充值
				</view>
			</view>
		</view>
		<tui-divider :gradual="true" width="40%" :gradualColor="gradualColor" color="#000" :size="28">金币明细</tui-divider>
		<view class="main">
			<view class="mainUl">
				<view class="mainLi">
					<view class="liLeft">
						<view class="title">
							观看创意视频
						</view>
						<view class="time">
							2020/12/04 09:33
						</view>
					</view>
					<view class="liRight">
						<image src="../../../static/images/coin.png" mode=""></image>
						<text>+ 60</text>
					</view>
				</view>
				<view class="mainLi">
					<view class="liLeft">
						<view class="title">
							观看创意视频
						</view>
						<view class="time">
							2020/12/04 09:33
						</view>
					</view>
					<view class="liRight">
						<image src="../../../static/images/coin.png" mode=""></image>
						<text>+ 60</text>
					</view>
				</view>
				<view class="mainLi">
					<view class="liLeft">
						<view class="title">
							观看创意视频
						</view>
						<view class="time">
							2020/12/04 09:33
						</view>
					</view>
					<view class="liRight">
						<image src="../../../static/images/coin.png" mode=""></image>
						<text>+ 60</text>
					</view>
				</view>
				<view class="mainLi">
					<view class="liLeft">
						<view class="title">
							观看创意视频
						</view>
						<view class="time">
							2020/12/04 09:33
						</view>
					</view>
					<view class="liRight">
						<image src="../../../static/images/coin.png" mode=""></image>
						<text>+ 60</text>
					</view>
				</view>
				<view class="mainLi">
					<view class="liLeft">
						<view class="title">
							观看创意视频
						</view>
						<view class="time">
							2020/12/04 09:33
						</view>
					</view>
					<view class="liRight">
						<image src="../../../static/images/coin.png" mode=""></image>
						<text>+ 60</text>
					</view>
				</view>
				<view class="mainLi">
					<view class="liLeft">
						<view class="title">
							观看创意视频
						</view>
						<view class="time">
							2020/12/04 09:33
						</view>
					</view>
					<view class="liRight">
						<image src="../../../static/images/coin.png" mode=""></image>
						<text>+ 60</text>
					</view>
				</view>
				<view class="mainLi">
					<view class="liLeft">
						<view class="title">
							观看创意视频
						</view>
						<view class="time">
							2020/12/04 09:33
						</view>
					</view>
					<view class="liRight">
						<image src="../../../static/images/coin.png" mode=""></image>
						<text>+ 60</text>
					</view>
				</view>
				<!--加载loadding-->
				<tui-loadmore v-if="loadding"></tui-loadmore>
				<tui-nomore v-if="!pullUpOn"></tui-nomore>
				<!--加载loadding-->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				loadding: false,
				pullUpOn: true,
				gradualColor: ['#fff', '#666']
			}
		},
		onReady() {},
		methods: {
			handleExtract () {
				uni.navigateTo({
					url:"/pages/center/myWallet/extract"
				})
			},
			handleRecharge () {
				uni.navigateTo({
					url:"/pages/center/myWallet/recharge"
				})
			}
		},
		onPullDownRefresh: function() {
			//延时为了看效果
			setTimeout(() => {
				this.newsList = this.loadData;
				this.pageIndex = 1;
				this.pullUpOn = true;
				this.loadding = false;
				uni.stopPullDownRefresh();
				this.tui.toast("刷新成功");
			}, 200)
		},
		
		// 页面上拉触底事件的处理函数
		onReachBottom: function() {
			if (!this.pullUpOn) return;
			this.loadding = true;
			if (this.pageIndex == 3) {
				this.loadding = false;
				this.pullUpOn = false;
			} else {
				this.newsList = this.newsList.concat(this.loadData);
				this.pageIndex = this.pageIndex + 1;
			}
		}
	}
</script>
<style>
	page {
		background: #fff;
	}
</style>
<style scoped lang="scss">
	.container {
		padding-bottom: 90rpx;

		.header {
			.headerBg {
				position: absolute;
				left: 0;
				top: 0;
				width: 100%;
				height: 175rpx;
				border-radius: 0 0 35rpx 35rpx;
				background: linear-gradient(#fc4250, #fe744b);
				z-index: 0;
			}

			.panel {
				position: relative;
				z-index: 1;
				display: flex;
				width: 690rpx;
				height: 254rpx;
				margin: 16rpx auto 0;
				border-radius: 12rpx;
				box-shadow: 0 0 10rpx rgba($color: #000000, $alpha: .1);
				background: rgba(255, 255, 255, 1);

				.panelBg {
					position: absolute;
					left: 0;
					top: 0;
					width: 100%;
					height: 100%;
					background: url(../../../static/images/coin.png) no-repeat 450rpx -95rpx;
					background-size: 290rpx 290rpx;
					opacity: .15;
				}

				.myCoin,
				.toDadyCoin {
					padding-top: 70rpx;
					flex: 1;
					text-align: center;

					.num {
						margin-bottom: 18rpx;
						line-height: 100%;
						font-size: 34rpx;
						font-weight: bold;
						color: #000;
					}

					.text {
						line-height: 100%;
						font-size: 24rpx;
						color: #999;
					}
				}
			}

			.panel-btn {
				position: relative;
				z-index: 1;
				width: 690rpx;
				margin: -40rpx auto 30rpx;
				text-align: center;

				.extractBtn,
				.rechargeBtn {
					display: inline-block;
					width: 320rpx;
					height: 80rpx;
					margin: 0 11rpx;
					line-height: 80rpx;
					border-radius: 40rpx;
					background: linear-gradient(to right, #ff3756, #ee794a);
					font-size: 28rpx;
					color: #fff;
					text-align: center;
				}
			}
		}

		.main {
			padding: 0 30rpx;

			.mainUl {
				.mainLi {
					display: flex;
					-webkit-box-pack: justify;
					-webkit-justify-content: space-between;
					-ms-flex-pack: justify;
					justify-content: space-between;
					height: 152rpx;
					align-items: center;
					border-bottom: 1px solid #f3f3f3;

					.liLeft {
						.title {
							margin-bottom: 38rpx;
							line-height: 100%;
							font-size: 26rpx;
							color: #000;
						}

						.time {
							line-height: 100%;
							font-size: 26rpx;
							color: #666;
						}
					}

					.liRight {
						display: flex;

						image {
							width: 38rpx;
							height: 38rpx;
						}

						text {
							padding-left: 18rpx;
							font-size: 26rpx;
							color: #f04b4d;
						}
					}
				}
			}
		}
	}
</style>
